package service

import (
	"fmt"
	"choujiang/common/db"
	"choujiang/common/models"
)

//计算用户的好友数量和参与抽奖的数量
func GetUserCenterNum(user *model.User) (int64, int64) {
	userExtra := new(model.UserExtra)
	friendsCount, err := db.MysqlEngine.Where("parent_id=?", user.Id).Count(userExtra)
	if err != nil {
		fmt.Printf("-----[GetUserCenterNum] friendsCount err: %s", err)
	}
	userGoodsLog := new(model.UserGoodsLog)
	logCount, err := db.MysqlEngine.Where("user_id=?", user.Id).Count(userGoodsLog)
	if err != nil {
		fmt.Printf("-----[GetUserCenterNum] logCount err: %s", err)
	}

	return friendsCount, logCount
}
